<?php

namespace Apps\Common\Models;

/**
 * 记事本会员表
 * @author      545
 * @date        2016年3月3日
 * @version     1.1.2
 * @copyright   Copyright 2015 meelier.com
 */

class Members extends \PhalconPlus\Database\Model
{

    /**
     *
     * @var integer
     */
    public $member_id;

    /**
     *
     * @var string
     */
    public $member_name;

    /**
     *
     * @var integer
     */
    public $member_tel;

    /**
     *
     * @var string
     */
    public $createtime;

    /**
     *
     * @var integer
     */
    public $remark;

    /**
     *
     * @var integer
     */
    public $user_id;


    /**
     * Returns table name mapped in the model.
     *
     * @return string
     */
    public function getSource()
    {
        return 'note_members';
    }

    /**
     * Allows to query a set of records that match the specified conditions
     *
     * @param mixed $parameters
     * @return Activity[]
     */
    public static function find($parameters = null)
    {
        return parent::find($parameters);
    }

    /**
     * Allows to query the first record that match the specified conditions
     *
     * @param mixed $parameters
     * @return Activity
     */
    public static function findFirst($parameters = null)
    {
        return parent::findFirst($parameters);
    }

    /**
     * Independent Column Mapping.
     * Keys are the real names in the table and the values their names in the application
     *
     * @return array
     */
    public function columnMap()
    {
        return array(
            'member_id' => 'member_id',
            'member_name' => 'member_name',
            'member_tel' => 'member_tel',
            'createtime' => 'createtime',
            'remark' => 'remark',
            'user_id' => 'user_id'
        );
    }

    public function defaultColumns()
    {
        return [
            'member_id',
            'member_name',
            'member_tel',
            'createtime',
            'remark',
            'user_id'
        ];
    }

    /**
     * 增加浏览数
     * @param int $id 活动id
     * @param int $count 增加数量
     */
    /*public static function setViews($id, $count = 100)
    {
        (new Activity())->getReadConnection()->query("UPDATE activity SET views = views + {$count} WHERE activity_id = {$id}");
    }*/

}
